package com.android.volley.socket;

import android.content.Context;

import com.android.volley.BuildConfig;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.DiskBasedCache;

import java.io.File;

/**
 *
 */
public class SocketClient {
    private static final String DEFAULT_CACHE_DIR = "volley";
    private static final String SERVER_CONFIG = "/server_config";
    public static String filesDir = "/data/data/"+ BuildConfig.APP_ID+"/files";


    public static RequestQueue newRequestQueue(Context context) {
        File cacheDir = new File(context.getCacheDir(), DEFAULT_CACHE_DIR);

        RequestQueue queue = new RequestQueue(new DiskBasedCache(cacheDir), initSocketNetwork(context));

        queue.start();

        return queue;
    }


    public static SocketNetwork initSocketNetwork(Context context) {
        filesDir = context.getFilesDir().getPath();
        return new SocketNetwork(filesDir +SERVER_CONFIG);
    }

}
